//微信小程序适配器
module.exports=function(request, responseCallback) {
  var con = {
    method: request.method,
    url: request.url,
    dataType: request.dataType || undefined,
    header: request.headers,
    data: request.body||{},
    responseType: request.responseType || 'text',
    success(res) {
      responseCallback({
        statusCode: res.statusCode,
        responseText: res.data,
        headers: res.header,
        statusMessage: res.errMsg
      })
    },
    fail(res) {
      responseCallback({
        statusCode: res.statusCode||0,
        statusMessage: res.errMsg
      })
    }
  }
  if (!request.WX_NOT_SEND) {
    wx.request(con)
  } else {
    responseCallback({
      statusCode: 500,
      responseText: {
        code: 90000,
      },
      statusMessage: 'WX_USER_ABORT'
    })
  }
}
